from selenium import webdriver
from pprint import pprint
from multiprocessing import Pool

# global driver
driver = webdriver.Chrome(executable_path=r"C:\00pcao\01soft\chromedriver.exe")
driver.get('https://www.baidu.com')


# element1 = driver.find_element_by_xpath('//input[@id="kw"]')
# element2 = driver.find_element_by_xpath('//input[@id="su"]')
# print(element1.get_attribute('name'))
# print(element2.get_attribute('value'))

class TEST:
    # def __init__(self, args):
    #     self.args = args

    def __call__(self, xpath):
        ele = driver.find_element_by_xpath(xpath)
        return ele


if __name__ == '__main__':
    p = Pool(2)
    ele = p.map(TEST, ['//input[@id="kw"]', '//input[@id="su"]'])
    p.close()
    p.join()
    print(ele)
